package com.awangyh.jdk8.lambda;

import java.util.Arrays;
import java.util.Comparator;

/**
 * Created by admin on 2017/3/22.
 */
public class StringCompareDemo {

    public static void main(String[] args) {

        String[] list = {"saaa", "fs", "sdfsdfcsdf", "hello", "word", "welcome", "done"};
        for ( int i = 0; i < list.length; i++) {
            System.out.println(list[i]);
        }
        System.out.println("=========================");
        Comparator<String> comp = (f, s) -> Integer.compare(f.length(), s.length());
        //Arrays.sort(list, comp);
        Arrays.sort(list, String::compareToIgnoreCase);

        for ( int i = 0; i < list.length; i++) {
            System.out.println(list[i]);
        }


    }
}
